<!-- 入会准则 -->
<template>
  <a-card title="入会准则" :bordered="false" class="br-10">
    <s-table size="default" ref="table" rowKey="id" :pagination="false" :columns="columns" :data="loadData">
      <span slot="serial" slot-scope="text, record, index">
        {{ index + 1 }}
      </span>
      <span slot="enableCarousel" slot-scope="text">
        {{ text ? '开启' : '关闭' }}
      </span>
      <span slot="action" slot-scope="text, record">
        <a-button type="primary" ghost size="small" class="_mr-5" @click="handleSmallEdit(record, 0)">
          详情
        </a-button>
        <a-button type="primary" ghost size="small" class="_mr-5" @click="handleSmallEdit(record, 1)">
          编辑
        </a-button>
      </span>
    </s-table>
    <join-rule-edit ref="edit" @edit="$refs.table.refresh(true)" />
  </a-card>
</template>

<script>
import { headquartersRuleList } from '@/api/system/system'
import joinRuleEdit from './joinRuleEdit.vue'
import { STable } from '@/components'
export default {
  components: {
    joinRuleEdit,
    STable
  },
  data() {
    return {
      dataList: [],
      columns: [
        {
          title: '标题',
          dataIndex: 'title'
        },
        {
          title: '添加时间',
          dataIndex: 'createTime'
        },
        {
          title: '操作',
          width: '150px',
          dataIndex: 'action',
          scopedSlots: { customRender: 'action' }
        }
      ],
      loadData: parameter => {
        return headquartersRuleList(Object.assign(parameter))
      }
    }
  },
  computed: {},
  watch: {},
  methods: {
    async getHeadquartersRuleList() {
      let { data } = await headquartersRuleList()
      this.dataList = data.records || []
    },
    handleSmallEdit(record, type) {
      var params = {
        title: '编辑',
        type,
        data: record
      }
      this.$refs.edit.open(params)
    }
  },
  created() {
    // this.getHeadquartersRuleList()
  },
  mounted() {}
}
</script>
<style scoped>
.p24 {
  padding: 24px;
}
</style>
